//
//  ZFBNavigationController.m
//  01-ZFB
//
//  Created by My Mac on 2017/6/1.
//  Copyright © 2017年 MyMac. All rights reserved.
//

#import "ZFBNavigationController.h"

@interface ZFBNavigationController ()

@end

@implementation ZFBNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置导航条字体颜色和大小
    self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor] , NSFontAttributeName : [UIFont systemFontOfSize:16]};
    //以下两行代码：去掉导航条阴影线 (另一个作用：将导航条透明了)
    //1.设置导航条背景图为空
    [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    //2.设置导航条阴影线背景图为空
    [self.navigationBar setShadowImage:[UIImage new]];
    
    //设置导航条背景色50,137,204
    self.navigationBar.barTintColor = NAV_COLOR;
    //因为上两句代码等于将导航条透明了，所以关闭半透明效果
    self.navigationBar.translucent = NO;
    //设置导航条字体颜色
    self.navigationBar.tintColor = [UIColor whiteColor];
}

-(UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0) {
        //push时隐藏底部栏
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:YES];
}

-(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
{
    if (self.viewControllers.count > 0) {
        //push时隐藏底部栏
        self.hidesBottomBarWhenPushed = YES;
    }
    
    [super dismissViewControllerAnimated:flag completion:completion];
}

@end
